use leptos::prelude::*;

/// Badge Component
#[component]
#[must_use]
pub fn UiBadge(
    #[prop(optional)] class: Option<String>,
    #[prop(optional, into)] text: String,
) -> impl IntoView {
    let base = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium";
    let class = class.map_or_else(|| base.to_string(), |c| format!("{base} {c}"));

    view! {
        <span class=class>{text}</span>
    }
}
